﻿
//
// Copyright (c) 2019-2023 BPer
//
#ifndef BPerAudioPlay_H
#define BPerAudioPlay_H

#include <bperaudiodev/BPerAudioRenderData.h>
#include <bperavutil/audio/BPerRtcAec.h>
#include <bperutil/BPerAvInfoType.h>
#include "bperutil/buffer/BPerAudioPlayBuffer.h"

#include <bperutil/sys/BPerThread2.h>
#define BPerAudioBufferMaxNum 10

#include<algorithm>
#include <vector>

using namespace std;

class BPerAudioPlay:public BPerThread
{
    public:
        BPerAudioPlay(BPerAVInfo* avinfo,BPerSynBufferManager* streams);
        virtual ~BPerAudioPlay();
    public:

        int32_t aIndex;
        virtual int init()=0;
        void setAudioBuffers(vector<BPerAudioPlayBuffer*> *paudioList);
        void setAudioBuffer(BPerAudioPlayBuffer *paudioList);
        void setAecBase(BPerRtcAec* pace);
        int32_t m_aecInit=0;
        int32_t m_isStart;
        void stop();
        BPerAudioRenderData m_audioData;
    protected:
        virtual void startLoop()=0;
        virtual void stopLoop()=0;

        void run();
        BPerAVInfo *m_avinfo;
        BPerRtcAec *m_ace;
        int	m_frames;
        int	m_channel;
        int	m_sample;

    };

#endif // BPERAUDIOCAPTURE_H
